const express = require('express')
const router = express.Router()
const controller = require('../controller/product')
const auth = require('../middleware/auth')

router.post('/api/product', controller.add)
router.delete('/api/product/:id', controller.remove)
router.put('/api/product', controller.update)
router.get('/api/product', controller.list)
router.get('/api/product/:id', controller.detail)
router.get('/product', controller.showIndex)
router.get('/product/add', controller.showAdd)
router.get('/product/edit/:id', controller.showEdit)

router.post('/admin/product', auth, controller.add)
router.delete('/admin/product/:id', auth, controller.remove)
router.put('/admin/product', auth, controller.update)
router.get('/admin/product', auth, controller.list)
router.get('/admin/product/:id', auth, controller.detail)

module.exports = router